﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DAL;
using System.Text;
public partial class Article_Article : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         
    }

    public Model.Article Article()
    {
        if (Request.QueryString["Id"] != null)
        {
            if (new Article().Exists(Convert.ToInt32(Request.QueryString["Id"])))
                return new Article().GetModel(Convert.ToInt32(Request.QueryString["Id"].ToString()));
        } return new Model.Article();
    }

    public string CorrelateArticle()
    {
        StringBuilder sb = new StringBuilder();
        DataSet ds = new Article().GetList("Recommend=0 order by artDate desc", 8);
        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
            {
                sb.Append("<a class='LinkArticleCorrelative' title='文章标题：" + ds.Tables[0].Rows[i]["ArtTitle"].ToString() + "&#13;&#10;作&nbsp;&nbsp;&nbsp;&nbsp;者：" + ds.Tables[0].Rows[i]["ArtAuthor"].ToString() + "&#13;&#10;更新时间：" + Convert.ToDateTime(ds.Tables[0].Rows[i]["ArtDate"]).ToString("yyyy-MM-dd") + "'     href='" + ds.Tables[0].Rows[i]["OrderId"].ToString() + ".html' target='_self'>" + ds.Tables[0].Rows[i]["ArtTitle"].ToString() + "</a><br>");
            }
        }
        return sb.ToString();
    }

}
